home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Gooey1.3.1 / C++ Templates / mmCModalDialog.c < prev    next >
Text File  |  1993-12-17  |  3KB  |  112 lines

  1. $$Message MM Modal Dialog, mm:mmModalDialogObject.cp
  2. $$File mm:mmModalDialogObject.cp
  3. /*  mmModalDialogObject                 */
  4. /*  $CopyRight$ */
  5.  
  6. /*    File name:  mmModalDialogObject
  7.     Function:  Basic modal dialog object
  8.  
  9.     History: $Date$ Original by $Author$
  10.  
  11. */
  12.  
  13. #include "mmCommon$Prototype.name$.h"    /* Common */
  14. #include "Common$Prototype.name$.h"        /* Common */
  15.  
  16.  
  17. /* ======================================================= */
  18. /* ======================================================= */
  19.  
  20. Boolean CmmModalDialog::FilterThisEvent(DialogPtr theDialog,EventRecord *theEvent,short *itemHit)
  21. {
  22. Boolean        FilterItOut;
  23. /* Expected to be overridden by the dialog code */
  24. FilterItOut = false;
  25. return(FilterItOut);
  26. }
  27.  
  28. /* ======================================================= */
  29.  
  30. void CmmModalDialog::FilterMouseDown(DialogPtr theDialog,EventRecord *theEvent,short *itemHit,Point MyPt)
  31. {
  32. /* Expected to be overridden by the dialog code */
  33. }
  34.  
  35. /* ======================================================= */
  36.  
  37. /* Routine: MyFilter */
  38. /* Purpose: Filter routine, also used for initial setup of dimmed states */
  39.  
  40. pascal Boolean theModalDialogFilter(DialogPtr theDialog,EventRecord *theEvent,short *itemHit)
  41. {
  42. Boolean            FilterValue;                            /* Temporary return value */
  43. Point            MyPt;
  44.  
  45.  
  46. FilterValue = false;
  47. if (gCurrentModalDialog != nil)
  48.     {
  49.     FilterValue = gCurrentModalDialog->FilterThisEvent(theDialog,theEvent,itemHit);
  50.     
  51.     /* Only do on an update */
  52.     if ((theEvent->what == updateEvt)  && ((WindowPtr)theEvent->message == theDialog))
  53.         {
  54.         BeginUpdate(theDialog);                        /* Start the update */
  55.         DrawDialog(theDialog);                        /* Draw the controls */
  56.         FilterValue = true;                            /* Pass out this special itemHit number */
  57.         *itemHit = 32000;                            /* Our special ID */
  58.         }
  59.     
  60.     if (theEvent->what == mouseDown)                /* Only do on a mouse click */
  61.         {
  62.         MyPt = theEvent->where;                        /* Get the point where the mouse was clicked */
  63.         GlobalToLocal(&MyPt);                        /* Convert global to local */
  64.  
  65.         gCurrentModalDialog->FilterMouseDown(theDialog,theEvent,itemHit,MyPt);
  66.         }
  67.     
  68.     CheckKeysInDialog(theDialog,&FilterValue,theEvent,itemHit);
  69.     }
  70.  
  71. return(FilterValue);
  72. }
  73.  
  74. /* ======================================================= */
  75.  
  76. void CmmModalDialog::Init()
  77. {
  78.  
  79. inherited::Init();
  80.  
  81. this->theWindow = nil;
  82. this->ExitDialog = false;
  83. /* Expected to be overridden by the dialog code */
  84. }
  85.  
  86. /* ======================================================= */
  87.  
  88. void CmmModalDialog::ExtraSetup()
  89. {
  90. /* Expected to be overridden by the dialog code */
  91. }
  92.  
  93. /* ======================================================= */
  94.  
  95. void CmmModalDialog::DoItemHit(short *itemHit,Boolean *ExitDialog)
  96. {
  97. /* Expected to be overridden by the dialog code */
  98. }
  99.  
  100. /* ======================================================= */
  101.  
  102. void CmmModalDialog::Exit()
  103. {
  104. /* Expected to be overridden by the dialog code */
  105. }
  106.  
  107. /* ======================================================= */
  108. /* ======================================================= */
  109. $$CloseFile
  110.  
  111.  
  112.